import { Callout } from 'nextra/components'

# Document Import

This feature allows you to import Umo Editor proprietary document formats, Office and WPS documents (including: doc, docx, xls, xlsx, ppt, pptx, odp, odt, ods, rtf, wps, et, dps, etc.), Markdown, and plain text documents into the Umo Editor.

## Demo Video

<video src="https://s1.umodoc.com/videos/import.mp4" controls="true"></video>

## Configuration Example

```js {2-7}
const defaultOptions = {
  // The toolbar.importWord option has been removed, please use import.office instead
  toolbar: {
    importWord: { 
      // ...
    },
  },
  // Document import related configuration
  import: {
    office: {
      limitSize: 50, // 50 MB
    },
    markdown: {},
    text: {
      replaceEmptyLines: false,
    },
  },
}
```
<Callout type="error" emoji="❗">
**Note:** In Umo Editor Next, the `toolbar.importWord` option has been removed. Please use `import.office` instead.
</Callout>

## Configuration Details

### import.office

**Description:** Configuration for importing Office documents, supports importing Office and WPS documents in formats such as doc, docx, xls, xlsx, ppt, pptx, odp, odt, ods, rtf, wps, et, dps, etc. You can also extend supported formats.

**Type:** `Object`

**Default:**

```js
{
  limitSize: 50, // 50 MB
}
```

**Options:**

- `limitSize`: Maximum file size allowed for import, default is 50 MB.

### import.markdown

**Description:** Configuration for importing Markdown documents.

**Type:** `Object`

**Default:** `{}`

**Options:**

- `enabled`: Enable importing Markdown files, default is `true`.
- `options`: Configuration for MarkdownIt, see: https://markdown-it.github.io/markdown-it/#MarkdownIt.new .

### import.text

**Description:** Configuration for importing text documents, used to configure text document import functionality.

**Type:** `Object`

**Default:** `{}`

**Options:**

- `replaceEmptyLines`: Whether to replace empty lines in the document, default is `false`.

## Methods

### importDocument

**Description:** Import Umo Editor documents, supports `.umo` format exported by Umo Editor.

**Parameters:**

- `file`, File, the `.umo` document exported by Umo Editor.

**Returns:** `Boolean`, whether the import was successful.

### importOffice

**Description:** Import Office documents, supports formats such as doc, docx, xls, xlsx, ppt, pptx, odp, odt, ods, rtf, wps, et, dps, etc.

**Parameters:**

- `file`, File, the Office document file.

**Returns:** `Boolean`, whether the import was successful.

### importMarkdown

**Description:** Import Markdown document content.

**Parameters:**

`object`, MarkdownIt configuration, see: https://markdown-it.github.io/markdown-it/#MarkdownIt.new , default uses `import.markdown.options`.

**Returns:** `Boolean`, whether the import was successful.

### importText

**Description:** Import plain text content.

**Parameters:**

- `text`, String, the text content.
- `replaceEmptyLines`, Boolean, whether to replace empty lines, default uses `import.text.replaceEmptyLines`.

**Returns:** `Boolean`, whether the import was successful.

## Markdown Syntax Extension

### Highlight Block

Use `:::` to mark the start and end of a highlight block.

```
:::info
Highlight block content
:::
```